package com.thoughtworks;

import java.util.ArrayList;

public class App {

  public static void main(String[] args) {
    Student Zhang3 = new Student("张三", "3");
    Student Li4 = new Student("李四", "4");
    Student Wang5 = new Student("王五", "5");
    Student Zhao6 = new Student("赵六", "6");
    Student Qian7 = new Student("钱七", "7");

    MemoryRepository repository = new MemoryRepository();
    repository.save(Zhang3.id, Zhang3);
    repository.save(Li4.id, Li4);
    repository.save(Wang5.id, Wang5);
    repository.save(Zhao6.id, Zhao6);
    repository.save(Qian7.id, Qian7);

    Student returnStudent = repository.get("3");
    System.out.println(returnStudent.id+returnStudent.name);

    repository.delete("4");
    Student Feng5 = new Student("冯五", "5");
    repository.update("5", Feng5);

    ArrayList<Student> newStudents = new ArrayList<Student>(repository.students.values());
    RepositoryUtil.printList(newStudents);
  }
}
